import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:get/get.dart';
import 'package:smart_devices/bruno/src/components/tabbar/normal/brn_tab_bar.dart';
import 'package:smart_devices/bruno/src/components/tag/brn_tag_custom.dart';
import 'package:smart_devices/icons/flutter_icons.dart';
import 'package:smart_devices/routes/index.dart';
import 'package:smart_devices/utils/colors.dart';
import 'package:smart_devices/utils/styles.dart';
import 'package:smart_devices/utils/tools.dart';
import 'info_logic.dart';

class DeviceInfoView extends GetView<DeviceInfoLogic> {
  const DeviceInfoView({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return GetBuilder<DeviceInfoLogic>(
      builder: (_) {
        return Scaffold(
          backgroundColor:
              ColorsUtils.parseColorFromHexString(ColorsUtils.colorF6f6),
          appBar: AppBar(
            leading: IconButton(
              icon: const Icon(
                Icons.arrow_back_ios,
                color: Colors.white,
                size: 15,
              ),
              onPressed: Get.back,
            ),
            automaticallyImplyLeading: false,
            backgroundColor:
                ColorsUtils.parseColorFromHexString(ColorsUtils.color0052),
            title: Text(
              '设备详情',
              style: StylesUtils.customTextStyle(
                  fontSize: 18, fontWeight: FontWeight.w700),
            ),
            centerTitle: true,
            systemOverlayStyle: SystemUiOverlayStyle.dark,
            actions: [
              PopupMenuButton<String>(
                itemBuilder: (BuildContext context) {
                  return [
                    PopupMenuItem(
                      height: 40,
                      padding: const EdgeInsets.symmetric(horizontal: 10),
                      textStyle: StylesUtils.customTextStyle(
                          color: ColorsUtils.colorFfff),
                      child: const Center(
                        child: Text('设备报修'),
                      ),
                      onTap: () {},
                    ),
                    PopupMenuItem(
                      height: 40,
                      padding: const EdgeInsets.symmetric(horizontal: 10),
                      textStyle: StylesUtils.customTextStyle(
                          color: ColorsUtils.colorFfff),
                      child: const Center(
                        child: Text('设备维修'),
                      ),
                      onTap: () {},
                    ),
                    PopupMenuItem(
                      height: 40,
                      padding: const EdgeInsets.symmetric(horizontal: 10),
                      textStyle: StylesUtils.customTextStyle(
                          color: ColorsUtils.colorFfff),
                      child: const Center(
                        child: Text('设备保养'),
                      ),
                      onTap: () {},
                    ),
                    PopupMenuItem(
                      height: 40,
                      padding: const EdgeInsets.symmetric(horizontal: 10),
                      textStyle: StylesUtils.customTextStyle(
                          color: ColorsUtils.colorFfff),
                      child: const Center(
                        child: Text('设备巡检'),
                      ),
                      onTap: () {},
                    ),
                    PopupMenuItem(
                      height: 40,
                      padding: const EdgeInsets.symmetric(horizontal: 10),
                      textStyle: StylesUtils.customTextStyle(
                          color: ColorsUtils.colorFfff),
                      child: const Center(
                        child: Text('设备点检'),
                      ),
                      onTap: () {},
                    ),
                  ];
                },
                icon: Icon(
                  AntDesign.menuunfold,
                  color: Colors.white,
                  size: 20,
                ),
                elevation: 0,
                constraints: const BoxConstraints(maxWidth: 100),
                splashRadius: 10,
                color:
                    ColorsUtils.parseColorFromHexString(ColorsUtils.color3333),
                offset: const Offset(0, 60),
                padding: EdgeInsets.zero,
              ),
            ],
          ),
          body: SingleChildScrollView(
            padding: const EdgeInsets.symmetric(vertical: 15, horizontal: 10),
            child: Column(
              children: [
                Container(
                  height: 100,
                  padding: const EdgeInsets.all(10),
                  decoration: BoxDecoration(
                      borderRadius: BorderRadius.circular(5),
                      color: ColorsUtils.parseColorFromHexString(
                          ColorsUtils.colorFfff)),
                  child: Row(
                    children: [
                      Container(
                        width: 80,
                        height: 80,
                        alignment: Alignment.center,
                        decoration: BoxDecoration(
                          borderRadius: BorderRadius.circular(5),
                          color: ColorsUtils.parseColorFromHexString(
                              ColorsUtils.color669e),
                        ),
                        child: ToolsUtils.assetImageSvg('u48851.svg',
                            width: 46, height: 58),
                      ),
                      Expanded(
                          child: Container(
                        padding: const EdgeInsets.only(left: 10),
                        alignment: Alignment.centerLeft,
                        child: Column(
                          children: [
                            Container(
                              alignment: Alignment.centerLeft,
                              child: Text(
                                '电动机2023',
                                style: StylesUtils.customTextStyle(
                                    fontWeight: FontWeight.bold,
                                    color: ColorsUtils.color1c24,
                                    fontSize: 18),
                              ),
                            ),
                            Container(
                              margin: const EdgeInsets.symmetric(vertical: 5),
                              alignment: Alignment.centerLeft,
                              child: Wrap(
                                spacing: 5,
                                runAlignment: WrapAlignment.center,
                                crossAxisAlignment: WrapCrossAlignment.center,
                                children: [
                                  Icon(
                                    AntdIcons.locationFill,
                                    size: 20,
                                    color: ColorsUtils.parseColorFromHexString(
                                        ColorsUtils.color9999),
                                  ),
                                  Text(
                                    '生产车间二层',
                                    style: StylesUtils.customTextStyle(
                                        color: ColorsUtils.color9999),
                                  )
                                ],
                              ),
                            ),
                            Container(
                              alignment: Alignment.centerLeft,
                              child: BrnTagCustom(
                                tagText: '正常运行',
                                textColor: Colors.white,
                                tagBorderRadius: BorderRadius.circular(3),
                                maxWidth: 60,
                                backgroundColor:
                                    ColorsUtils.parseColorFromHexString(
                                        ColorsUtils.color0bb2),
                                fontSize: 12,
                              ),
                            )
                          ],
                        ),
                      )),
                      Container(
                        width: 40,
                        alignment: Alignment.center,
                        child: IconButton(
                          onPressed: () {
                            Get.toNamed(Routes.deviceDetails);
                          },
                          icon: Icon(
                            AntdIcons.right,
                            size: 12,
                            color: ColorsUtils.parseColorFromHexString(
                                ColorsUtils.color9999),
                          ),
                        ),
                      )
                    ],
                  ),
                ),
                Container(
                  margin: const EdgeInsets.only(top: 15),
                  decoration: BoxDecoration(
                      borderRadius: BorderRadius.circular(5),
                      color: ColorsUtils.parseColorFromHexString(
                          ColorsUtils.colorFfff)),
                  child: ListBody(
                    children: [
                      Container(
                        height: 40,
                        padding: const EdgeInsets.symmetric(horizontal: 10),
                        alignment: Alignment.centerLeft,
                        child: Text(
                          '设备概况',
                          style: StylesUtils.customTextStyle(
                              color: ColorsUtils.color1c24),
                        ),
                      ),
                      Container(
                        padding: const EdgeInsets.only(left: 20, bottom: 15),
                        alignment: Alignment.centerLeft,
                        child: Text(
                          '最后故障时间：2023-02-23 12:23',
                          style: StylesUtils.customTextStyle(
                              color: ColorsUtils.color9999),
                        ),
                      ),
                      Container(
                        padding: const EdgeInsets.only(bottom: 15),
                        alignment: Alignment.center,
                        child: Container(
                          width: 320,
                          height: 80,
                          decoration: BoxDecoration(
                              color: ColorsUtils.colorFromHexString(
                                  ColorsUtils.colorF3f6),
                              borderRadius: BorderRadius.circular(5)),
                          child: CustomPaint(
                            painter: _MyPainter(),
                            child: Row(
                              children: [
                                Expanded(
                                    child: Column(
                                  children: [
                                    Expanded(
                                        child: Center(
                                      child: Text(
                                        '8',
                                        style: StylesUtils.customTextStyle(
                                            color: ColorsUtils.color0052,
                                            fontSize: 18),
                                      ),
                                    )),
                                    Expanded(
                                        child: Center(
                                      child: Text(
                                        '故障次数',
                                        style: StylesUtils.customTextStyle(
                                            color: ColorsUtils.color3333,
                                            fontSize: 14),
                                      ),
                                    )),
                                  ],
                                )),
                                Expanded(
                                    child: Column(
                                  children: [
                                    Expanded(
                                        child: Center(
                                      child: Text(
                                        '12',
                                        style: StylesUtils.customTextStyle(
                                            color: ColorsUtils.color0052,
                                            fontSize: 18),
                                      ),
                                    )),
                                    Expanded(
                                        child: Center(
                                      child: Text(
                                        '停机次数',
                                        style: StylesUtils.customTextStyle(
                                            color: ColorsUtils.color3333,
                                            fontSize: 14),
                                      ),
                                    )),
                                  ],
                                ))
                              ],
                            ),
                          ),
                        ),
                      ),
                      BrnTabBar(
                        tabHeight: 50,
                        mode: BrnTabBarBadgeMode.origin,
                        controller: controller.tabController,
                        indicatorColor: ColorsUtils.parseColorFromHexString(
                            ColorsUtils.color0052),
                        labelColor: ColorsUtils.parseColorFromHexString(
                            ColorsUtils.color0052),
                        labelStyle: StylesUtils.customTextStyle(fontSize: 14),
                        unselectedLabelColor: ColorsUtils.rgba(0, 0, 0, 0.6),
                        unselectedLabelStyle:
                            StylesUtils.customTextStyle(fontSize: 14),
                        tabs: controller.tabs,
                        indicatorWidth: 50,
                        indicatorWeight: 3,
                        onTap: (BrnTabBarState state, int index) {
                          controller.pageController.animateToPage(index,
                              duration: const Duration(milliseconds: 500),
                              curve: Curves.linear);
                        },
                      ),
                      SizedBox(
                        height: 180,
                        child: PageView(
                          controller: controller.pageController,
                          children: getPageView(controller.tabs.length),
                          onPageChanged: (int index) {
                            controller.tabController.animateTo(index,
                                duration: const Duration(milliseconds: 500),
                                curve: Curves.linear);
                          },
                        ),
                      )
                    ],
                  ),
                ),
                Container(
                  margin: const EdgeInsets.only(top: 15),
                  decoration: BoxDecoration(
                      borderRadius: BorderRadius.circular(5),
                      color: ColorsUtils.parseColorFromHexString(
                          ColorsUtils.colorFfff)),
                  child: ListBody(
                    children: [
                      SizedBox(
                        height: 50,
                        child: Row(
                          children: [
                            Container(
                              width: 50,
                              alignment: Alignment.center,
                              child: ToolsUtils.assetImageSvg('u48875.svg',
                                  width: 20, height: 20),
                            ),
                            Expanded(
                                child: Container(
                              alignment: Alignment.centerLeft,
                              padding: const EdgeInsets.only(right: 20),
                              child: Row(
                                mainAxisAlignment:
                                    MainAxisAlignment.spaceBetween,
                                children: [
                                  Text(
                                    '维修记录',
                                    style: StylesUtils.customTextStyle(
                                        color: ColorsUtils.color3333),
                                  ),
                                  Obx(() => Text(
                                        '最后维修x${controller.date.value}',
                                        style: StylesUtils.customTextStyle(
                                            color: ColorsUtils.color9999),
                                      ))
                                ],
                              ),
                            )),
                            InkWell(
                              onTap: () {
                                Get.toNamed(Routes.deviceMaintainRecord,
                                    arguments: {'id': 1});
                              },
                              child: Container(
                                width: 40,
                                alignment: Alignment.center,
                                child: Icon(
                                  AntdIcons.right,
                                  color: ColorsUtils.parseColorFromHexString(
                                      ColorsUtils.color9999),
                                  size: 15,
                                ),
                              ),
                            )
                          ],
                        ),
                      ),
                      SizedBox(
                        height: 50,
                        child: Row(
                          children: [
                            Container(
                              width: 50,
                              alignment: Alignment.center,
                              child: ToolsUtils.assetImageSvg('u48883.svg',
                                  width: 20, height: 20),
                            ),
                            Expanded(
                                child: Container(
                              alignment: Alignment.centerLeft,
                              padding: const EdgeInsets.only(right: 20),
                              child: Row(
                                mainAxisAlignment:
                                    MainAxisAlignment.spaceBetween,
                                children: [
                                  Text(
                                    '保养记录',
                                    style: StylesUtils.customTextStyle(
                                        color: ColorsUtils.color3333),
                                  ),
                                ],
                              ),
                            )),
                            InkWell(
                              onTap: () {
                                Get.toNamed(Routes.deviceUpkeepRecord,
                                    arguments: {'id': 1});
                              },
                              child: Container(
                                width: 40,
                                alignment: Alignment.center,
                                child: Icon(
                                  AntdIcons.right,
                                  color: ColorsUtils.parseColorFromHexString(
                                      ColorsUtils.color9999),
                                  size: 15,
                                ),
                              ),
                            )
                          ],
                        ),
                      ),
                      SizedBox(
                        height: 50,
                        child: Row(
                          children: [
                            Container(
                              width: 50,
                              alignment: Alignment.center,
                              child: ToolsUtils.assetImageSvg('u48893.svg',
                                  width: 20, height: 20),
                            ),
                            Expanded(
                                child: Container(
                              alignment: Alignment.centerLeft,
                              padding: const EdgeInsets.only(right: 20),
                              child: Row(
                                mainAxisAlignment:
                                    MainAxisAlignment.spaceBetween,
                                children: [
                                  Text(
                                    '巡检记录',
                                    style: StylesUtils.customTextStyle(
                                        color: ColorsUtils.color3333),
                                  ),
                                ],
                              ),
                            )),
                            InkWell(
                              onTap: () {
                                Get.toNamed(Routes.deviceInspectionRecord,
                                    arguments: {'id': 1});
                              },
                              child: Container(
                                width: 40,
                                alignment: Alignment.center,
                                child: Icon(
                                  AntdIcons.right,
                                  color: ColorsUtils.parseColorFromHexString(
                                      ColorsUtils.color9999),
                                  size: 15,
                                ),
                              ),
                            )
                          ],
                        ),
                      ),
                      SizedBox(
                        height: 50,
                        child: Row(
                          children: [
                            Container(
                              width: 50,
                              alignment: Alignment.center,
                              child: ToolsUtils.assetImageSvg('u48903.svg',
                                  width: 20, height: 20),
                            ),
                            Expanded(
                                child: Container(
                              alignment: Alignment.centerLeft,
                              padding: const EdgeInsets.only(right: 20),
                              child: Row(
                                mainAxisAlignment:
                                    MainAxisAlignment.spaceBetween,
                                children: [
                                  Text(
                                    '点检记录',
                                    style: StylesUtils.customTextStyle(
                                        color: ColorsUtils.color3333),
                                  ),
                                ],
                              ),
                            )),
                            Container(
                              width: 40,
                              alignment: Alignment.center,
                              child: Icon(
                                AntdIcons.right,
                                color: ColorsUtils.parseColorFromHexString(
                                    ColorsUtils.color9999),
                                size: 15,
                              ),
                            )
                          ],
                        ),
                      ),
                      SizedBox(
                        height: 50,
                        child: Row(
                          children: [
                            Container(
                              width: 50,
                              alignment: Alignment.center,
                              child: ToolsUtils.assetImageSvg('u48912.svg',
                                  width: 20, height: 20),
                            ),
                            Expanded(
                                child: Container(
                              alignment: Alignment.centerLeft,
                              padding: const EdgeInsets.only(right: 20),
                              child: Row(
                                mainAxisAlignment:
                                    MainAxisAlignment.spaceBetween,
                                children: [
                                  Text(
                                    '报修记录',
                                    style: StylesUtils.customTextStyle(
                                        color: ColorsUtils.color3333),
                                  ),
                                ],
                              ),
                            )),
                            InkWell(
                              onTap: () {
                                Get.toNamed(Routes.deviceRepairRecord,
                                    arguments: {'id': 1});
                              },
                              child: Container(
                                width: 40,
                                alignment: Alignment.center,
                                child: Icon(
                                  AntdIcons.right,
                                  color: ColorsUtils.parseColorFromHexString(
                                      ColorsUtils.color9999),
                                  size: 15,
                                ),
                              ),
                            )
                          ],
                        ),
                      ),
                      SizedBox(
                        height: 50,
                        child: Row(
                          children: [
                            Container(
                              width: 50,
                              alignment: Alignment.center,
                              child: ToolsUtils.assetImageSvg('u48919.svg',
                                  width: 20, height: 20),
                            ),
                            Expanded(
                                child: Container(
                              alignment: Alignment.centerLeft,
                              padding: const EdgeInsets.only(right: 20),
                              child: Row(
                                mainAxisAlignment:
                                    MainAxisAlignment.spaceBetween,
                                children: [
                                  Text(
                                    '关联备件',
                                    style: StylesUtils.customTextStyle(
                                        color: ColorsUtils.color3333),
                                  ),
                                  Text(
                                    '15',
                                    style: StylesUtils.customTextStyle(
                                        color: ColorsUtils.color9999),
                                  )
                                ],
                              ),
                            )),
                            InkWell(
                              onTap: () {
                                Get.toNamed(Routes.deviceSparePart,
                                    arguments: {'total': 15, 'id': 1});
                              },
                              child: Container(
                                width: 40,
                                alignment: Alignment.center,
                                child: Icon(
                                  AntdIcons.right,
                                  color: ColorsUtils.parseColorFromHexString(
                                      ColorsUtils.color9999),
                                  size: 15,
                                ),
                              ),
                            )
                          ],
                        ),
                      ),
                      SizedBox(
                        height: 50,
                        child: Row(
                          children: [
                            Container(
                              width: 50,
                              alignment: Alignment.center,
                              child: ToolsUtils.assetImageSvg('u48928.svg',
                                  width: 20, height: 20),
                            ),
                            Expanded(
                                child: Container(
                              alignment: Alignment.centerLeft,
                              padding: const EdgeInsets.only(right: 20),
                              child: Row(
                                mainAxisAlignment:
                                    MainAxisAlignment.spaceBetween,
                                children: [
                                  Text(
                                    '关联图片',
                                    style: StylesUtils.customTextStyle(
                                        color: ColorsUtils.color3333),
                                  ),
                                  Text(
                                    '9',
                                    style: StylesUtils.customTextStyle(
                                        color: ColorsUtils.color9999),
                                  )
                                ],
                              ),
                            )),
                            InkWell(
                              onTap: () {
                                Get.toNamed(Routes.devicePicture);
                              },
                              child: Container(
                                width: 40,
                                alignment: Alignment.center,
                                child: Icon(
                                  AntdIcons.right,
                                  color: ColorsUtils.parseColorFromHexString(
                                      ColorsUtils.color9999),
                                  size: 15,
                                ),
                              ),
                            )
                          ],
                        ),
                      ),
                      SizedBox(
                        height: 50,
                        child: Row(
                          children: [
                            Container(
                              width: 50,
                              alignment: Alignment.center,
                              child: ToolsUtils.assetImageSvg('u48938.svg',
                                  width: 20, height: 20),
                            ),
                            Expanded(
                                child: Container(
                              alignment: Alignment.centerLeft,
                              padding: const EdgeInsets.only(right: 20),
                              child: Row(
                                mainAxisAlignment:
                                    MainAxisAlignment.spaceBetween,
                                children: [
                                  Text(
                                    '关联文档',
                                    style: StylesUtils.customTextStyle(
                                        color: ColorsUtils.color3333),
                                  ),
                                  Text(
                                    '5',
                                    style: StylesUtils.customTextStyle(
                                        color: ColorsUtils.color9999),
                                  )
                                ],
                              ),
                            )),
                            InkWell(
                              onTap: () {
                                Get.toNamed(Routes.deviceDocument);
                              },
                              child: Container(
                                width: 40,
                                alignment: Alignment.center,
                                child: Icon(
                                  AntdIcons.right,
                                  color: ColorsUtils.parseColorFromHexString(
                                      ColorsUtils.color9999),
                                  size: 15,
                                ),
                              ),
                            )
                          ],
                        ),
                      ),
                    ],
                  ),
                )
              ],
            ),
          ),
        );
      },
      init: controller,
    );
  }

  List<Widget> getPageView([int len = 3]) {
    List<Widget> list = [];
    list.add(Container(
      padding: const EdgeInsets.symmetric(horizontal: 10),
      child: Column(
        children: [
          SizedBox(
            height: 50,
            child: Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: [
                Text(
                  '上次保养时间：2023-10-12 12:45:13',
                  style:
                      StylesUtils.customTextStyle(color: ColorsUtils.color9999),
                ),
                Text(
                  '张晓明',
                  style:
                      StylesUtils.customTextStyle(color: ColorsUtils.color9999),
                )
              ],
            ),
          ),
          Table(
            textDirection: TextDirection.ltr,
            defaultVerticalAlignment: TableCellVerticalAlignment.middle,
            border: TableBorder.all(
                color:
                    ColorsUtils.parseColorFromHexString(ColorsUtils.colorF2f2)),
            children: [
              TableRow(
                  decoration: BoxDecoration(
                      color: ColorsUtils.parseColorFromHexString(
                          ColorsUtils.colorF9f9)),
                  children: [
                    TableCell(
                        verticalAlignment: TableCellVerticalAlignment.middle,
                        child: Container(
                          height: 40,
                          alignment: Alignment.center,
                          child: Text(
                            '保养数量',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color4950),
                          ),
                        )),
                    TableCell(
                        verticalAlignment: TableCellVerticalAlignment.middle,
                        child: Container(
                          alignment: Alignment.center,
                          child: Text(
                            '已保养',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color4950),
                          ),
                        )),
                    TableCell(
                        verticalAlignment: TableCellVerticalAlignment.middle,
                        child: Container(
                          alignment: Alignment.center,
                          child: Text(
                            '未保养',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color4950),
                          ),
                        )),
                  ]),
              TableRow(
                  decoration: BoxDecoration(
                      color: ColorsUtils.parseColorFromHexString(
                          ColorsUtils.colorFfff)),
                  children: [
                    TableCell(
                        child: Container(
                      height: 40,
                      alignment: Alignment.center,
                      child: Text(
                        '8项',
                        style: StylesUtils.customTextStyle(
                            color: ColorsUtils.color9999),
                      ),
                    )),
                    TableCell(
                        child: Container(
                            alignment: Alignment.center,
                            child: TextButton(
                                onPressed: () {
                                  Get.toNamed(Routes.deviceMaintained,
                                      arguments: {'count': 6, 'id': 1});
                                },
                                child: Text(
                                  '6项',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.color0052),
                                )))),
                    TableCell(
                        child: Container(
                            alignment: Alignment.center,
                            child: TextButton(
                                onPressed: () {
                                  Get.toNamed(Routes.deviceUnmaintained,
                                      arguments: {'count': 2, 'id': 1});
                                },
                                child: Text(
                                  '2项',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.colorFf90),
                                )))),
                  ]),
            ],
          ),
          Container(
            height: 50,
            alignment: Alignment.centerRight,
            child: Text(
              '距下次保养还有3天03小时20分钟',
              style: StylesUtils.customTextStyle(color: ColorsUtils.color9999),
            ),
          )
        ],
      ),
    ));
    list.add(Container(
      padding: const EdgeInsets.symmetric(horizontal: 10),
      child: Column(
        children: [
          SizedBox(
            height: 50,
            child: Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: [
                Text(
                  '上次巡检时间：2023-10-12 12:45:13',
                  style:
                      StylesUtils.customTextStyle(color: ColorsUtils.color9999),
                ),
                Text(
                  '张晓明',
                  style:
                      StylesUtils.customTextStyle(color: ColorsUtils.color9999),
                )
              ],
            ),
          ),
          Table(
            textDirection: TextDirection.ltr,
            defaultVerticalAlignment: TableCellVerticalAlignment.middle,
            border: TableBorder.all(
                color:
                    ColorsUtils.parseColorFromHexString(ColorsUtils.colorF2f2)),
            children: [
              TableRow(
                  decoration: BoxDecoration(
                      color: ColorsUtils.parseColorFromHexString(
                          ColorsUtils.colorF9f9)),
                  children: [
                    TableCell(
                        verticalAlignment: TableCellVerticalAlignment.middle,
                        child: Container(
                          height: 40,
                          alignment: Alignment.center,
                          child: Text(
                            '巡检项数',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color4950),
                          ),
                        )),
                    TableCell(
                        verticalAlignment: TableCellVerticalAlignment.middle,
                        child: Container(
                          alignment: Alignment.center,
                          child: Text(
                            '正常',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color4950),
                          ),
                        )),
                    TableCell(
                        verticalAlignment: TableCellVerticalAlignment.middle,
                        child: Container(
                          alignment: Alignment.center,
                          child: Text(
                            '异常',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color4950),
                          ),
                        )),
                  ]),
              TableRow(
                  decoration: BoxDecoration(
                      color: ColorsUtils.parseColorFromHexString(
                          ColorsUtils.colorFfff)),
                  children: [
                    TableCell(
                        child: Container(
                      height: 40,
                      alignment: Alignment.center,
                      child: Text(
                        '12项',
                        style: StylesUtils.customTextStyle(
                            color: ColorsUtils.color9999),
                      ),
                    )),
                    TableCell(
                        child: Container(
                            alignment: Alignment.center,
                            child: TextButton(
                                onPressed: () {},
                                child: Text(
                                  '8项',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.color0052),
                                )))),
                    TableCell(
                        child: Container(
                            alignment: Alignment.center,
                            child: TextButton(
                                onPressed: () {},
                                child: Text(
                                  '4项',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.colorFf90),
                                )))),
                  ]),
            ],
          ),
          Container(
            height: 50,
            alignment: Alignment.centerRight,
            child: Text(
              '距下次巡检还有3天03小时20分钟',
              style: StylesUtils.customTextStyle(color: ColorsUtils.color9999),
            ),
          )
        ],
      ),
    ));
    list.add(Container(
      padding: const EdgeInsets.symmetric(horizontal: 10),
      child: Column(
        children: [
          SizedBox(
            height: 50,
            child: Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: [
                Text(
                  '上次点检时间：2023-10-12 12:45:13',
                  style:
                      StylesUtils.customTextStyle(color: ColorsUtils.color9999),
                ),
                Text(
                  '张晓明',
                  style:
                      StylesUtils.customTextStyle(color: ColorsUtils.color9999),
                )
              ],
            ),
          ),
          Table(
            textDirection: TextDirection.ltr,
            defaultVerticalAlignment: TableCellVerticalAlignment.middle,
            border: TableBorder.all(
                color:
                    ColorsUtils.parseColorFromHexString(ColorsUtils.colorF2f2)),
            children: [
              TableRow(
                  decoration: BoxDecoration(
                      color: ColorsUtils.parseColorFromHexString(
                          ColorsUtils.colorF9f9)),
                  children: [
                    TableCell(
                        verticalAlignment: TableCellVerticalAlignment.middle,
                        child: Container(
                          height: 40,
                          alignment: Alignment.center,
                          child: Text(
                            '点检项数',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color4950),
                          ),
                        )),
                    TableCell(
                        verticalAlignment: TableCellVerticalAlignment.middle,
                        child: Container(
                          alignment: Alignment.center,
                          child: Text(
                            '正常',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color4950),
                          ),
                        )),
                    TableCell(
                        verticalAlignment: TableCellVerticalAlignment.middle,
                        child: Container(
                          alignment: Alignment.center,
                          child: Text(
                            '异常',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color4950),
                          ),
                        )),
                  ]),
              TableRow(
                  decoration: BoxDecoration(
                      color: ColorsUtils.parseColorFromHexString(
                          ColorsUtils.colorFfff)),
                  children: [
                    TableCell(
                        child: Container(
                      height: 40,
                      alignment: Alignment.center,
                      child: Text(
                        '9项',
                        style: StylesUtils.customTextStyle(
                            color: ColorsUtils.color9999),
                      ),
                    )),
                    TableCell(
                        child: Container(
                            alignment: Alignment.center,
                            child: TextButton(
                                onPressed: () {},
                                child: Text(
                                  '6项',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.color0052),
                                )))),
                    TableCell(
                        child: Container(
                            alignment: Alignment.center,
                            child: TextButton(
                                onPressed: () {},
                                child: Text(
                                  '3项',
                                  style: StylesUtils.customTextStyle(
                                      color: ColorsUtils.colorFf90),
                                )))),
                  ]),
            ],
          ),
          Container(
            height: 50,
            alignment: Alignment.centerRight,
            child: Text(
              '距下次点检还有3天03小时20分钟',
              style: StylesUtils.customTextStyle(color: ColorsUtils.color9999),
            ),
          )
        ],
      ),
    ));
    return list;
  }
}

class _MyPainter extends CustomPainter {
  @override
  void paint(Canvas canvas, Size size) {
    Paint paint = Paint()
      ..strokeWidth = 2
      ..isAntiAlias = false
      ..style = PaintingStyle.fill
      ..color = ColorsUtils.parseColorFromHexString(ColorsUtils.colorD7d7);
    Offset p1 = Offset(size.width / 2, size.height / 2 - 10);
    Offset p2 = Offset(size.width / 2, size.height / 2 + 10);
    canvas.drawLine(p1, p2, paint);
  }

  @override
  bool shouldRepaint(covariant CustomPainter oldDelegate) {
    return this != oldDelegate;
  }
}
